Media Gateway
How to obtain a public URL for a Golazos media. This document describes the on-chain and off-chain methods to obtain a public URL for a Golazos media asset, as well as how to size the media.
Access Media off-chain
Image English
https://assets.laligagolazos.com/editions/{playDataId}/{playDataId}__{mediaType}_2880_2880_default.png
=> https://assets.laligagolazos.com/editions/2301636_223255_recaA3NxyeVhBatBz/play_2301636_223255_recaA3NxyeVhBatBz__capture_Hero_Black_2880_2880_default.png
Image Spanish
https://assets.laligagolazos.com/editions/{playDataId}/{playDataId}__{mediaType}_2880_2880_es.png
=> https://assets.laligagolazos.com/editions/2219549_490541_recgWjaZiDnT4hfGg/play_2219549_490541_recgWjaZiDnT4hfGg__capture_Hero_Black_2880_2880_es.png
Video English
https://assets.laligagolazos.com/editions/{playDataId}/{playDataId}__capture_Animated_Video_Popout_Black_1080_1080_default.mp4
=> https://assets.laligagolazos.com/editions/2219549_490541_recgWjaZiDnT4hfGg/play_2219549_490541_recgWjaZiDnT4hfGg__capture_Animated_Video_Popout_Black_1080_1080_default.mp4
Video Spanish
https://assets.laligagolazos.com/editions/{playDataId}/{playDataId}__{mediaType}_1080_1080_es.mp4
=> https://assets.laligagolazos.com/editions/2219549_490541_recgWjaZiDnT4hfGg/play_2219549_490541_recgWjaZiDnT4hfGg__capture_Animated_Video_Popout_Black_1080_1080_es.mp4
playDataId
To obtain the playDataId of the play, pass the playId you want to retrieve media from into the script below.
import Golazos from 0x87ca73a41bb50ad5
pub fun main(playId: UInt64): {String: String}? {
let playData = Golazos.getPlayData(id: playId)
return playData?.metadata
}
The playDataId will look something like the following 2301636_223255_recaA3NxyeVhBatBz
. You will need to use this Id to create the media URL.
Media Types
The following media types are supported for each Golazos play.
image type: capture_Hero_Black english
image type: capture_Hero_Black spanish
image type: capture_Front_Black english
image type: capture_Front_Black spanish
image type: capture_Legal_Black english
image type: capture_Legal_Black spanish
image type: capture_Details_Black english
image type: capture_Details_Black spanish
video type: capture_Animated_Video_Popout_Black english
video type: capture_Animated_Video_Popout_Black spanish
video type: capture_Animated_Video_Idle_Black english
video type: capture_Animated_Video_Idle_Black spanish
Access Media on-chain
You can obtain an array of media supporting an NFT by executing a flow script. This script requires that you know the flow address of the owner of the NFT.
import NonFungibleToken from 0x1d7e57aa55817448
import MetadataViews from 0xMETADATAVIEWSADDRESS
import Golazos from 0x87ca73a41bb50ad5
pub fun main(ownerAddress: Address, nftId: UInt64): MetadataViews.Medias {
let nftOwner = getAccount(ownerAddress);
let collection = nftOwner
.getCapability(Golazos.CollectionPublicPath)!
.borrow<&{MetadataViews.ResolverCollection}>()!
let nft = collection.borrowViewResolver(id: nftId)!
// Get the basic Medias information for this NFT
let view = nft.resolveView(Type<MetadataViews.Medias>())!
let medias = view as! MetadataViews.Medias
return medias
}
This script will return an array of video and still images from the passed nftId in the owner’s collection.
Resizing Media
Use the Golazos CDN media CGI to resize your media.
CGI Base URL
https://laligagolazos.com/cdn-cgi/image/width=800,height=800,quality=50
Example
https://laligagolazos.com/cdn-cgi/image/width=800,height=800,quality=50/https://assets.laligagolazos.com/editions/2219413_246333_rec02fsO6eXiuFg14/play_2219413_246333_rec02fsO6eXiuFg14__capture_Hero_Black_2880_2880_default.png
In the example above, you append the play media URL at the end of the CGI base URL. You supply the width, height, and quality of the image. You can directly use the resized URL on our own apps and web sites.